package com.formiaomiao.demain.controller;

import com.formiaomiao.demain.model.LikeBean;
import com.formiaomiao.demain.service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LikeController {
    @Autowired
    LikeService likeService;

    @RequestMapping(value = "/like")
    @ResponseBody
    private Object UpdateLike(@RequestParam(name = "likeid", required = false) String likeid,
                              @RequestParam(name = "userid", required = false) Integer userid,
                              @RequestParam(name = "type", required = false) Integer type){
        LikeBean likeBean = new LikeBean();
        likeBean.setLikeid(likeid);
        likeBean.setLikerid(userid);
        likeBean.setLiketype(type);
        likeBean.setLikedate(String.valueOf(System.currentTimeMillis()));
        return likeService.updateLike(likeBean);
    }
}
